package pzl.com.waitnotify;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import pzl.com.waitnotify.beans.Resource;
import pzl.com.waitnotify.tasks.Input;
import pzl.com.waitnotify.tasks.Output;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

    }

    public void click(View view) {
        switch (view.getId()) {
            case R.id.btnProductionConsume:
                Resource r = new Resource();
                Input in = new Input(r);
                Output out = new Output(r);
                Thread t1 = new Thread(in);
                Thread t2 = new Thread(out);
                t1.start();
                t2.start();
                break;
        }
    }

}
